package day05_api.com.itheima.d3_method_reference;

import java.util.Arrays;
import java.util.Comparator;

public class Test3 {
    public static void main(String[] args) {
        String[] names = {"张三", "李四", "王五", "赵六", "田七"};
        Arrays.sort(names, new Comparator<String>() {
            @Override
            public int compare(String o1, String o2) {
                return o1.compareTo(o2);
            }
        });

        System.out.println("------------------------");
        Arrays.sort(names,(o1, o2) -> o1.compareTo(o2));

        Arrays.sort(names, String::compareTo);
        System.out.println("Arrays.toString(names) = " + Arrays.toString(names));
        System.out.println("names = " + names);
    }
}
